import { createProxy } from './proxy'
import { FastWorker, FastWorkerOptions } from './types'
import { FastWorkerRaw } from './workers'
export { asyncCallbackParameterTransfer, stringifyCallbackParameterTransfer } from './transfer'
export * from './types'

export const createFastWorker = <Module extends Record<keyof any, any>>(
  modulePath: string,
  options?: FastWorkerOptions<Module>
): FastWorker<Module> => {
  const workersInstance = new FastWorkerRaw(modulePath, options)
  return createProxy(workersInstance) as any
}
